import Vue from 'vue'

Vue.filter('stringToAsterisk', function (value, source) {
    // do something
    if (typeof value === 'string') {
        if (typeof source === 'number') {
            const tag = value.substring(source)
            return value.replace(tag, Array(tag.length).fill('*').join(''))
        } else if (Array.isArray(source)) {
            const start = source[0] || 0;
            const end = source[1] || value.length
            const tag = value.substring(start, end)
            return value.replace(tag, Array(tag.length).fill('*').join(''))
        } else {
            return value
        }
    }
    return value
})
